projects
/
project
/
bcm63xx
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2b1fa9d
)
Round the serial port clock divisor value returned by calc_divisor()
author
Hugo Villeneuve
<
[email protected]
>
Tue, 8 Jul 2008 18:54:58 +0000
(14:54 -0400)
committer
Wolfgang Denk
<
[email protected]
>
Wed, 9 Jul 2008 22:48:31 +0000
(
00:48
+0200)
Round the serial port clock divisor value returned by
calc_divisor().
Signed-off-by: Hugo Villeneuve <
[email protected]
>
Signed-off-by: John Roberts <
[email protected]
>
drivers/serial/serial.c
patch
|
blob
|
history
diff --git
a/drivers/serial/serial.c
b/drivers/serial/serial.c
index 76425d87901ff13930b02183e9347349e0aa8c0e..182ca2d149ead9aba81003418e0e6c418dec2890 100644
(file)
--- a/
drivers/serial/serial.c
+++ b/
drivers/serial/serial.c
@@
-144,8
+144,13
@@
static int calc_divisor (NS16550_t port)
#else
#define MODE_X_DIV 16
#endif
- return (CFG_NS16550_CLK / MODE_X_DIV / gd->baudrate);
+ /* Compute divisor value. Normally, we should simply return:
+ * CFG_NS16550_CLK) / MODE_X_DIV / gd->baudrate
+ * but we need to round that value by adding 0.5 or 8/16.
+ * Rounding is especially important at high baud rates.
+ */
+ return (((16 * CFG_NS16550_CLK) / MODE_X_DIV / gd->baudrate) + 8) / 16;
}
#if !defined(CONFIG_SERIAL_MULTI)